<!DOCTYPE html>
<script src=../../resources/testharness.js></script>
<script src=../../resources/testharnessreport.js></script>
<script>
// This test verifies that MediaStream can be created with captureStream() call.
function makeAsyncTest(frameRate) {
  return async_test(function(test) {
    var canvas = document.createElement('canvas');
    var stream = canvas.captureStream(frameRate);
    assert_not_equals(stream, null);
    assert_equals(stream.active, true);
    assert_equals(stream.getVideoTracks().length, 1);
    assert_equals(stream.getAudioTracks().length, 0);
    var track = stream.getVideoTracks()[0];
    assert_equals(track.readyState, 'live');
    assert_equals(track.enabled, true);
    assert_equals(track.muted, false);
    test.done();
  }, 'check <canvas> captureStream(' + frameRate + ')');
}

// Check all modes can be created
makeAsyncTest(undefined);
makeAsyncTest(0);
makeAsyncTest(30);
makeAsyncTest(65438);  // https://crbug.com/1172621
</script>
